﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:HomeManager.Controls">

	<Style x:Key="ButtonFocusVisual">
		<Setter Property="Control.Template">
			<Setter.Value>
				<ControlTemplate>
					<Rectangle RadiusX="4" RadiusY="4" Stroke="Gray" StrokeDashArray="1 2" StrokeThickness="1" Margin="2" SnapsToDevicePixels="true"/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type Controls:CommandButton}">
		<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
		<Setter Property="Foreground" Value="Navy"/>
		<Setter Property="HorizontalContentAlignment" Value="Center"/>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
		<Setter Property="Padding" Value="1"/>
		<Setter Property="FontSize" Value="11"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Controls:CommandButton}">
					<Border x:Name="Bd" BorderBrush="#00A5A5A5" BorderThickness="1" CornerRadius="4" Padding="5,10,5,10" SnapsToDevicePixels="True" >
						<Border.Background>
							<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
								<GradientBrush.GradientStops>
									<GradientStopCollection>
										<GradientStop Color="#FFFFFFFF" Offset="0"/>
										<GradientStop Color="#FFFFFFFF" Offset="1"/>
									</GradientStopCollection>
								</GradientBrush.GradientStops>
							</LinearGradientBrush>
						</Border.Background>
						<StackPanel>
							<ContentPresenter RecognizesAccessKey="True" Content="{TemplateBinding Header}" HorizontalAlignment="Left"/>
							<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Left">
								<ContentPresenter.Resources>
									<Style TargetType="TextBlock" >
										<Setter Property="TextTrimming" Value="None"/>
										<Setter Property="TextWrapping" Value="WrapWithOverflow"/>
									</Style>
								</ContentPresenter.Resources>
							</ContentPresenter>
						</StackPanel>
					</Border>
					<ControlTemplate.Resources>
						<Storyboard x:Key="sbMouseOverFadeIn">
							<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
								<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFFFFF"/>
								<SplineColorKeyFrame KeyTime="00:00:00.7000000" Value="#FFF0F0F0"/>
							</ColorAnimationUsingKeyFrames>
							<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
								<SplineColorKeyFrame KeyTime="00:00:00" Value="#00A5A5A5"/>
								<SplineColorKeyFrame KeyTime="00:00:00.7000000" Value="#FFA5A5A5"/>
							</ColorAnimationUsingKeyFrames>
						</Storyboard>
						<Storyboard x:Key="sbMouseOverFadeOut">
							<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
								<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFF0F0F0"/>
								<SplineColorKeyFrame KeyTime="00:00:00.6000000" Value="#FFFFFFFF"/>
							</ColorAnimationUsingKeyFrames>
							<ColorAnimationUsingKeyFrames  BeginTime="00:00:00" Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
								<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFA5A5A5"/>
								<SplineColorKeyFrame KeyTime="00:00:00.6000000" Value="#00A5A5A5"/>
							</ColorAnimationUsingKeyFrames>
						</Storyboard>
					</ControlTemplate.Resources>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Trigger.EnterActions>
								<BeginStoryboard Storyboard="{StaticResource sbMouseOverFadeIn}"/>
							</Trigger.EnterActions>
							<Trigger.ExitActions>
								<BeginStoryboard Storyboard="{StaticResource sbMouseOverFadeOut}"/>
							</Trigger.ExitActions>
							<Setter Property="BorderBrush" TargetName="Bd" Value="#FFA5A5A5"/>
						</Trigger>
						
						<Trigger Property="IsPressed" Value="true">
							<Setter Property="Background"  TargetName="Bd">
								<Setter.Value>
									<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
										<GradientBrush.GradientStops>
											<GradientStopCollection>
												<GradientStop Color="#FFF1F1F1" Offset="0"/>
												<GradientStop Color="#FFFFFFFF" Offset="1"/>
											</GradientStopCollection>
										</GradientBrush.GradientStops>
									</LinearGradientBrush>
								</Setter.Value>
							</Setter>
						</Trigger>
						<Trigger Property="IsEnabled" Value="false">
							<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>


</ResourceDictionary>